package webservice.cxf.util;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

public class CxfUtil {
	public static Object callWebService(Object[] paraArr, String url,String method,Class c) {
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

		factory.setServiceClass(c);
		factory.setAddress(url);

		Client client = ClientProxy.getClient(factory.create());

		Object[] result = null;
		try {
			result = client.invoke(method, paraArr);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Object ret = result[0];
		return ret;
	}
	
}
